Skip to content

Conversation

@elithrar
Copy link
Contributor

@elithrar elithrar commented Dec 19, 2025

When commenting on files in a PR/lines in a PR, opencode attempts to react (with eyes) and fails with a 404, breaking the workflow. This does not occur for issue comments.

There are two different APIs for this via octokit:

  1. one for issue comments - octokit.reactions.createForIssueComment
  2. one for PR comments - octokit.reactions.createForPullRequestReviewComment

opencode did not distinguish between the two - in packages/opencode/src/cli/cmd/github.ts the addReaction() function only worked for issues. I noticed this in my own GH reaction handling and had to make a similar fix.

This PR fixes this by passing a commentType parameter to addReaction() and removeReaction() functions and then using that to switch on the right octokit methods.

(It appears this hasn't been a flow others have run into before? The rest of the PR comment handling looks to be there + OK)

The GitHub agent was failing with 404 when triggered from PR review
comments because addReaction() and removeReaction() only used the
issue comment API endpoints. PR review comments require different
octokit methods:
- createForPullRequestReviewComment
- listForPullRequestReviewComment
- deleteForPullRequestComment
@elithrar
Copy link
Contributor Author

for ref:

Adding reaction...
POST /repos/elithrar/get-ratioed/issues/comments/2633462072/reactions - 404 with id 8840:A5CA:2DF98A:C80604:6944C5F7 in 130ms
118 |       request: requestOptions
119 |     });
120 |   }
Creating comment...
121 |   if (status >= 400) {
122 |     octokitResponse.data = await getResponseData(fetchResponse);
123 |     throw new RequestError(toErrorMessage(octokitResponse.data), status, {
                ^
HttpError: Not Found - https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue-comment
   status: 404,
  request: {
  method: "POST",
  url: "https://api.github.com/repos/elithrar/get-ratioed/issues/comments/2633462072/reactions",
  headers: [Object ...],
  body: [Object ...],
  request: [Object ...],
},
 response: {
  url: "https://api.github.com/repos/elithrar/get-ratioed/issues/comments/2633462072/reactions",
  status: 404,
  headers: [Object ...],
  data: [Object ...],
},

      at fetchWrapper (../../node_modules/.bun/@octokit+request@10.0.7/node_modules/@octokit/request/dist-bundle/index.js:123:11)

Removing reaction...
GET /repos/elithrar/get-ratioed/issues/comments/2633462072/reactions?content=eyes - 404 with id 8840:A5CA:2DFD15:C8144D:6944C5F8 in 125ms
Error: Unexpected error, check log file at /home/runner/.local/share/opencode/log/2025-12-19T032644.log for more details

HttpError: Not Found - https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment
   status: 404,
  request: {
  method: "GET",
  url: "https://api.github.com/repos/elithrar/get-ratioed/issues/comments/2633462072/reactions?content=eyes",
  headers: [Object ...],
  request: [Object ...],
},
 response: {
  url: "https://api.github.com/repos/elithrar/get-ratioed/issues/comments/2633462072/reactions?content=eyes",
  status: 404,
  headers: [Object ...],
  data: [Object ...],
},

      at fetchWrapper (../../node_modules/.bun/@octokit+request@10.0.7/node_modules/@octokit/request/dist-bundle/index.js:123:15)
      at processTicksAndRejections (native:7:39)

Error: Process completed with exit code 1.

@rekram1-node rekram1-node merged commit 100c31c into anomalyco:dev Dec 19, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants